home *** CD-ROM | disk | FTP | other *** search
/ Programmer Plus 2007 / Programmer-Plus-2007.iso / Programming / ActiveX Controlls / XP Suite / DATA1.CAB / XP_Popup_Menu_Sample_Files / Form1.frm (.txt) next >
Encoding:
Visual Basic Form  |  2003-04-24  |  8.2 KB  |  230 lines

  1. VERSION 5.00
  2. Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
  3. Object = "{CF5AF5C7-0AF7-4B49-9CE9-2CD700C0995F}#1.0#0"; "ciaXPPopupMenu.ocx"
  4. Begin VB.Form Form1 
  5.    Caption         =   "Form1"
  6.    ClientHeight    =   5310
  7.    ClientLeft      =   60
  8.    ClientTop       =   450
  9.    ClientWidth     =   7245
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   5310
  12.    ScaleWidth      =   7245
  13.    StartUpPosition =   3  'Windows Default
  14.    Begin ciaXPPopupMenu.XPMenu XPMenu1 
  15.       Left            =   1290
  16.       Top             =   4710
  17.       _ExtentX        =   847
  18.       _ExtentY        =   820
  19.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  20.          Name            =   "MS Sans Serif"
  21.          Size            =   8.25
  22.          Charset         =   0
  23.          Weight          =   400
  24.          Underline       =   0   'False
  25.          Italic          =   0   'False
  26.          Strikethrough   =   0   'False
  27.       EndProperty
  28.    End
  29.    Begin VB.CommandButton Command6 
  30.       Caption         =   "change a menu item - chunk method"
  31.       Height          =   495
  32.       Left            =   2745
  33.       TabIndex        =   7
  34.       Top             =   2880
  35.       Width           =   2000
  36.    End
  37.    Begin VB.CommandButton Command5 
  38.       Caption         =   "change a menu item font bold state"
  39.       Height          =   495
  40.       Left            =   2745
  41.       TabIndex        =   4
  42.       Top             =   2340
  43.       Width           =   2000
  44.    End
  45.    Begin VB.CommandButton Command4 
  46.       Caption         =   "change a menu item enable state"
  47.       Height          =   495
  48.       Left            =   2745
  49.       TabIndex        =   3
  50.       Top             =   660
  51.       Width           =   2000
  52.    End
  53.    Begin VB.CommandButton Command3 
  54.       Caption         =   "change a menu item forecolor"
  55.       Height          =   495
  56.       Left            =   2745
  57.       TabIndex        =   2
  58.       Top             =   1230
  59.       Width           =   2000
  60.    End
  61.    Begin VB.CommandButton Command2 
  62.       Caption         =   "change a menu item caption"
  63.       Height          =   495
  64.       Left            =   2745
  65.       TabIndex        =   1
  66.       Top             =   1785
  67.       Width           =   2000
  68.    End
  69.    Begin VB.CommandButton Command1 
  70.       Caption         =   "change a menu item check state"
  71.       Height          =   495
  72.       Left            =   2745
  73.       TabIndex        =   0
  74.       Top             =   105
  75.       Width           =   2000
  76.    End
  77.    Begin MSComctlLib.ImageList ImageList1 
  78.       Left            =   630
  79.       Top             =   4650
  80.       _ExtentX        =   1005
  81.       _ExtentY        =   1005
  82.       BackColor       =   -2147483643
  83.       ImageWidth      =   16
  84.       ImageHeight     =   16
  85.       MaskColor       =   12632256
  86.       _Version        =   393216
  87.       BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
  88.          NumListImages   =   12
  89.          BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  90.             Picture         =   "Form1.frx":0000
  91.             Key             =   ""
  92.          EndProperty
  93.          BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  94.             Picture         =   "Form1.frx":055A
  95.             Key             =   ""
  96.          EndProperty
  97.          BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  98.             Picture         =   "Form1.frx":0AB4
  99.             Key             =   ""
  100.          EndProperty
  101.          BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  102.             Picture         =   "Form1.frx":100E
  103.             Key             =   ""
  104.          EndProperty
  105.          BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  106.             Picture         =   "Form1.frx":1568
  107.             Key             =   ""
  108.          EndProperty
  109.          BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  110.             Picture         =   "Form1.frx":212A
  111.             Key             =   ""
  112.          EndProperty
  113.          BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  114.             Picture         =   "Form1.frx":2684
  115.             Key             =   ""
  116.          EndProperty
  117.          BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  118.             Picture         =   "Form1.frx":2BDE
  119.             Key             =   ""
  120.          EndProperty
  121.          BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  122.             Picture         =   "Form1.frx":3138
  123.             Key             =   ""
  124.          EndProperty
  125.          BeginProperty ListImage10 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  126.             Picture         =   "Form1.frx":3692
  127.             Key             =   ""
  128.          EndProperty
  129.          BeginProperty ListImage11 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  130.             Picture         =   "Form1.frx":3BEC
  131.             Key             =   ""
  132.          EndProperty
  133.          BeginProperty ListImage12 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  134.             Picture         =   "Form1.frx":4146
  135.             Key             =   ""
  136.          EndProperty
  137.       EndProperty
  138.    End
  139.    Begin VB.Label Label2 
  140.       AutoSize        =   -1  'True
  141.       Caption         =   "2.  Change the font property, including size"
  142.       Height          =   195
  143.       Left            =   2145
  144.       TabIndex        =   6
  145.       Top             =   3750
  146.       Width           =   3015
  147.    End
  148.    Begin VB.Label Label1 
  149.       AutoSize        =   -1  'True
  150.       Caption         =   "1.  Click anywhere on the form to display the menu"
  151.       Height          =   195
  152.       Left            =   2145
  153.       TabIndex        =   5
  154.       Top             =   3480
  155.       Width           =   3555
  156.    End
  157. Attribute VB_Name = "Form1"
  158. Attribute VB_GlobalNameSpace = False
  159. Attribute VB_Creatable = False
  160. Attribute VB_PredeclaredId = True
  161. Attribute VB_Exposed = False
  162. Private Type POINTAPI
  163.         X As Long
  164.         Y As Long
  165. End Type
  166. Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
  167. Option Explicit
  168. Dim Menu1 As XPMenuLib
  169. Dim subMenu1 As XPMenuLib
  170. Dim subMenu2 As XPMenuLib
  171. Dim subMenu3 As XPMenuLib
  172. Private Sub Command1_Click()
  173. subMenu1.SetChecked 2, True
  174. End Sub
  175. Private Sub Command2_Click()
  176. Menu1.SetCaption 1, "Change Menu Item"
  177. End Sub
  178. Private Sub Command3_Click()
  179. Menu1.SetForeColor 1, vbBlue
  180. End Sub
  181. Private Sub Command4_Click()
  182. subMenu2.SetEnabled 2, False
  183. End Sub
  184. Private Sub Command5_Click()
  185. subMenu1.SetBold 2, True
  186. End Sub
  187. Private Sub Command6_Click()
  188. Menu1.ChangeItemProperties 4, 3, "Changed Chunk", False, True, True, vbBlue
  189. End Sub
  190. Private Sub Form_Load()
  191. XPMenu1.SetImageList ImageList1
  192. Set Menu1 = XPMenu1.AddMenu("Menu1")
  193. Set subMenu1 = XPMenu1.AddMenu("subMenu1")
  194. Set subMenu2 = XPMenu1.AddMenu("subMenu2")
  195. Set subMenu3 = XPMenu1.AddMenu("subMenu3")
  196. With subMenu3
  197.     .AddItem 10, "Toggle Operator Certification", menuTextItem
  198.     .AddItem 0, "Edit Certification Tables", menuTextItem
  199.     .AddItem 9, "View Who's Certified", menuTextItem
  200. End With
  201. With subMenu2
  202.     .AddItem 10, "Toggle Security", menuTextItem
  203.     .AddItem 0, "Edit Security Access", menuTextItem
  204.     .AddItem 9, "View Security Log-Ins", menuSubMenu, , , , , , subMenu3
  205. End With
  206. With subMenu1
  207.     .AddItem 10, "ISO Document", menuTextItem
  208.     .AddItem 0, "CAD Drawing", menuSubMenu, , , , , , subMenu2
  209.     .AddItem 9, "Historical Database ", menuTextItem
  210. End With
  211. With Menu1
  212.     .AddItem 10, "New", menuSubMenu, , , , , , subMenu1
  213.     .AddItem 3, "Open", menuTextItem
  214.     .AddItem 0, "", menuSeperator
  215.     .AddItem 0, "Save", menuTextItem
  216.     .AddItem 0, "Save As", menuTextItem
  217.     .AddItem 0, "", menuSeperator
  218.     .AddItem 1, "Exit", menuTextItem
  219. End With
  220. Me.Move (Screen.Width - Me.ScaleWidth) \ 2, (Screen.Height - Me.ScaleHeight) \ 2
  221. End Sub
  222. Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  223. Dim pos As POINTAPI
  224. GetCursorPos pos
  225. XPMenu1.ShowMenu "Menu1", pos.X, pos.Y, TopCenter
  226. End Sub
  227. Private Sub XPMenu1_Click(menuName As String, itemNum As Integer, itemText As String)
  228. MsgBox "" & "menu name = " & menuName & ", itemNum = " & itemNum & ", itemText = " & itemText
  229. End Sub
  230.